<?php


namespace app\admin\model;


class ApprovalOvertime extends Base
{
    public function getList($t,$map,$query = [])
    {
        if($t == 1) {
            $list = $this->where($map)->order('apply_time desc')->paginate(10,false,['query' => $query]);
        }else {
            $list = $this->where($map)->order('apply_time desc')->select();
        }
        foreach ($list as $key => $value) {
            $status = [0 => "待审批", 1 => "审批通过", 2=> "审批不通过", 3=>"进行中"];
            $value['status_text'] = $status[$value['status']];
            $type = [1 => "普通审批", 2 => "应急审批"];
            $value['type_text'] = $type[$value['type']];
            $user = $this->getUser($value['apply_user']);
            $value['apply_name'] = $user ? $user['name'] : "无该用户信息";
            $value['start_time_text'] = date("Y-m-d H:i",$value['start_time']);
            $value['end_time_text'] = date("Y-m-d H:i",$value['end_time']);
            $value['apply_time_text'] = date("Y-m-d H:i",$value['apply_time']);
        }
        return $list;
    }
}